package com.btex.app.treaty.adapter;

import android.widget.ProgressBar;
import android.widget.TextView;

import com.btex.app.R;
import com.btex.app.entity.OrderBookInfo;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * @author zy zhangyi <zhangyi, 1104745049@QQ.com
 * @version v1.0
 * @project study1
 * @Description
 * @encoding UTF-8
 * @date 2018/11/1
 * @time 上午11:48
 * @修改记录 <pre>
 * 版本       修改人         修改时间         修改内容描述
 * --------------------------------------------------
 * <p>
 * --------------------------------------------------
 * </pre>
 */

public class KBuyAdapter extends BaseQuickAdapter<OrderBookInfo.DataBean.SellBean, BaseViewHolder> {
    private int mMax;

    public KBuyAdapter() {
        super(R.layout.wei_tuo_buy);
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderBookInfo.DataBean.SellBean item) {



        TextView wei_tuo_tv_number = (TextView) helper.getView(R.id.wei_tuo_tv_number);
        TextView wei_tuo_tv_price = (TextView) helper.getView(R.id.wei_tuo_tv_price);
        ProgressBar wei_tuo_tv_buy = (ProgressBar) helper.getView(R.id.wei_tuo_tv_buy);

        wei_tuo_tv_buy.setMax(mMax);
        double ceil = Math.ceil(Double.valueOf(item.getAmount()));
        wei_tuo_tv_buy.setProgress((int) ceil);
        String price = item.getPrice();
        String amount = item.getAmount();

        wei_tuo_tv_number.setText(amount);
        wei_tuo_tv_price.setText(price);

    }


    public void setMax(int max) {

        mMax = max;
    }
}
